
Use NEXUS_DB

GO
--------------------------------------Insert---------------
ALTER PROC insertEmployee 
	@employeeUserName varchar(255) ,
	@employeePassword Varchar(255) ,
	@employeeFullName nvarchar(255),
	@employeeAddress nvarchar(500),
	@employeeEmail varchar(255),
	@employeePhone varchar(20) ,
	@typeID int,
	@StoreID int
	
AS
if (@StoreID=-1)  
	set @StoreID=null

INSERT INTO  Employee(employeeUserName,employeePassword,employeeFullName,employeeAddress,employeeEmail,employeePhone,typeID,StoreID)
 VALUES(@employeeUserName,@employeePassword,@employeeFullName,@employeeAddress,@employeeEmail,@employeePhone,@typeID,@StoreID)

--insertEmployee 'dwea','ada','adada','','','',1,1
GO
---------------------------------------------------update-------------------
ALTER PROC updateEmployee
	@employeeID int ,
	@employeeUserName varchar(255) ,
	@employeePassword Varchar(255) ,
	@employeeFullName nvarchar(255),
	@employeeAddress nvarchar(500),
	@employeeEmail varchar(255),
	@employeePhone varchar(20) ,
	@typeID int,
	@StoreID int
AS
if (@StoreID=-1)  
	set @StoreID=null
UPDATE Employee SET	
	employeeUserName=@employeeUserName,
	employeePassword =@employeePassword,
	employeeFullName =@employeeFullName,
	employeeAddress=@employeeAddress,
	employeeEmail =@employeeEmail,
	employeePhone=@employeePhone,
	typeID =@typeID,
	StoreID=@StoreID
WHERE employeeID=@employeeID
GO
---------------------------------------Delete--------------------

CREATE PROC deleteEmployee
	@employeeID int
AS
	DELETE FROM Employee WHERE employeeID=@employeeID
GO
--------------------------------------------get all---------------------
CREATE PROC getAllEmployee
AS
SELECT     Employee.*, EmployeeType.typeName
FROM         Employee INNER JOIN
                      EmployeeType ON Employee.typeID = EmployeeType.typeID
GO
---------------------------------------------login---------------------
CREATE PROC employeeLogin
	@employeeUserName varchar(255) ,
	@employeePassword varbinary(255) 
AS
SELECT * from Employee where employeeUserName=@employeeUserName and employeePassword=@employeePassword
GO

---------------------------------------getEmployeeByID---------------
CREATE PROC getEmployeeByID
	@employeeID int
AS
SELECT * from Employee where employeeID=@employeeID


